package leetcode.ge100;

import leetcode.lt100.TreeNode;

class Solution_101 {

    public boolean isSymmetric(TreeNode root) {
        return isContrary(root.left, root.right);
    }

    private boolean isContrary(TreeNode left, TreeNode right) {
        return (left == null && right == null) || (left != null && right != null && left.val == right.val && isContrary(left.left, right.right) && isContrary(left.right, right.left));
    }

}